package com.mario.nanjing.ai.controller;

import dev.langchain4j.model.chat.ChatModel;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author MarioZzz
 * @create 2025-08-02 15:20
 */
@RestController
@RequestMapping("/lc4j/modelParam")
public class ModelParameterController {
    @Resource
    private ChatModel chatModelQwen;

    @GetMapping(value = "/config")
    public String config(@RequestParam(value = "prompt", defaultValue = "你是谁") String prompt) {
        String result = chatModelQwen.chat(prompt);

        System.out.println("通过langchain4j调用模型返回结果：" + result);

        return result;
    }
}
